package com.hice.demo.springboot.jta.controller;

import com.hice.demo.springboot.jta.model.User;
import com.hice.demo.springboot.jta.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by hyson on 2017/3/10.
 */
@RestController
public class UserController {
    @Autowired
    UserService userService;

    @GetMapping("/add")
    public String add(User user){
        try {
            userService.add(user);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "add";
    }

    @GetMapping("/del")
    public String del(Long id){
        try {
            userService.del(id);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "del";
    }
}  